// Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
// This source file is part of the Cangjie project, licensed under Apache-2.0
// with Runtime Library Exception.
//
// See https://cangjie-lang.cn/pages/LICENSE for license information.

#ifndef CANGJIE_MIGRATOR_POSITION_RANGE
#define CANGJIE_MIGRATOR_POSITION_RANGE

#include "cangjie/AST/Node.h"

#include "Position.h"

namespace CangjieMigrator {

struct PositionRange {
    static PositionRange Empty();

    Position start;
    Position end;

    PositionRange(Position start, Position end);
    explicit PositionRange(const Cangjie::AST::Node &node);

    [[nodiscard]] bool IsInclude(const PositionRange &another) const;
    [[nodiscard]] bool IsInvalid() const;
    [[nodiscard]] bool IsEmpty() const;

    bool operator==(const PositionRange &other) const;
    bool operator!=(const PositionRange &other) const;

    [[nodiscard]] std::string ToString() const;
    friend std::ostream &operator<<(std::ostream &os, const PositionRange &range);
};

} // namespace CangjieMigrator

#endif // CANGJIE_MIGRATOR_POSITION_RANGE
